#include "cnconstantitem.h"
#include "cnpointitem.h"
#include "moduletype.h"
#include <QPainter>
#include <QPen>

#define CONNECTOR_LENGTH (5)

CNConstantItem::CNConstantItem(QGraphicsItem *parent):CNBaseItem(parent)
{
	setType(CN::DiagramType::Cons);
	CNPointItem* item = new CNPointItem(this);
	item->setType(CN::DiagramType::Pin);
	item->setName("PIN");
	item->setPos(boundingRect().width() / 2 + CONNECTOR_LENGTH, 0);
	item->setPoinFlag(CN::flagDerection::Right);
}

//
//int CNConstantItem::type() const
//{
//	return CN::DiagramType::Cons;
//}

void CNConstantItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
{
	CNBaseItem::paint(painter, option, widget);

	QRectF boundingRect = this->boundingRect();

	/*painter->save();
	painter->translate(boundingRect.bottomRight());
	painter->rotate(180);
	painter->drawLine(QPointF(boundingRect.width() / 2, 0), QPointF(boundingRect.width() / 2, -CONNECTOR_LENGTH));
	painter->restore();*/
}